<include file="../header" />
<style>
    .keyword-input{
        margin-top: 1rem;
    }
    .keyword-btn{
        margin-top: 0.5rem;
        width: 120px;
        float: left;
    }
    .kw-btn{
        width: 50px;
    }
    .shut-down{
        width: 12px;
        height: 12px;
        position: relative;
        left: -0.5rem;
        top: -0.9rem;
        cursor: pointer;
    }
</style>
<script type="text/javascript" src="/Template/js/vue.min.js"></script>

<body class="J_scroll_fixed" id="container">
<script type="text/javascript">
    $(function() {

        var app = new Vue({
            el: '#container',
            data: {
                keywordList: []
            },
            methods: {
                remove: function(index) {
                    app.keywordList.splice(index,1);
                }
            }
        });



        var description = UE.getEditor('description',{
            initialFrameHeight:300,
            initialContent : "",
            serverUrl :'{:U("activity/ueditorUpload")}'
        });


        $("button#upload").click(function(){
            //上传文件
            $.ajaxFileUpload({
                url:"{:U('activity/uploadImage')}",//处理图片脚本
                secureuri :false,
                fileElementId :'fileToUpload',//file控件id
                dataType : 'json',
                success : function (data, status){
                    $("input[name=imageUrl]").val(data);
                    $("img[name=preShow]").attr("src", data);
                },
                error: function(data, status, e){
                    alert(e);
                }
            })

        });

        $("button.btn_submit").click(function() {
            $("input[name=description]").val(description.getContent());
            $("form").submit();

        });

        $("select[name=faqClassId]").change(function() {
            if($(this).val() == 1 || $(this).val() == 6) {
                $(".imgUrl").show();
                $(".answer").hide();
            } else {
                $(".answer").show();
                $(".imgUrl").hide();
            }
        });

    })

</script>
<script type="text/javascript"  src="__TMP__/assets/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript"  src="__TMP__/assets/js/ueditor/ueditor.all.min.js"></script>
<div class="wrap jj">
    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('clubfoot/faqAddPost')}">
            <fieldset>
                <div class="control-group">
                    <label class="control-label">分类：</label>
                    <div class="controls">
                        <select name="faqClassId">
                            {:getFaqClassSelectOptionHtml(0, 0)}
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">标题：</label>
                    <div class="controls">
                        <input type="text" style="width: 40rem;" class="input" name="name" value="">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">问题：</label>
                    <div class="controls">
                        <textarea style="height:5rem; width: 40rem;" name="question"></textarea>
                    </div>
                </div>
                <div class="answer" style="display: none;">
                    <div class="control-group">
                        <label class="control-label">解答：</label>
                        <div class="controls">
                            <textarea style="height:15rem; width: 40rem;" name="answer"></textarea>
                        </div>
                    </div>
                </div>
                <div class="imgUrl">
                    <div class="control-group">
                        <label class="control-label">视频图片:</label>
                        <div class="controls">
                            <input id="fileToUpload" type="file" name="fileToUpload" style="width:170px;">
                            <button type="button" class="btn btn-primary" id="upload">上传</button>
                            <input type="hidden" name="imageUrl" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">图片预览:</label>
                        <div class="controls">
                            <img src="" name="preShow" style="width:250px;height:150px;" />
                            <div class="delete"></div>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">详情描述：</label>
                    <div class="controls">
                        <input type="hidden" name="description" />
                        <script type="text/plain" id="description" name="description"></script>
                    </div>
                </div>



            </fieldset>
            <div class="form-actions">
                <button type="button" class="btn btn-primary btn_submit">添加</button>
                <a class="btn" href="{:U('clubfoot/faq')}">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>